
from myApp.models import Student, Grade
from rest_framework import serializers

# 给学生类创建序列化类
class StudentSerializer(serializers.ModelSerializer):
    class Meta:
        model = Student
        fields = ("id", "name", "sex",  "age", "content", "grade", "isDelete")
        # 可以通过 python shell 看有哪些可以序列化:
        # from myApp.serializers import StudentSerializer
        # serializer = StudentSerializer()
        # print(serializer)
#         fields 中的元素决定了在shell 中可以看到有哪些可以序列化

class GradeSerializer(serializers.ModelSerializer):
    class Meta:
        model = Grade
        fields = ("id", "name", "boyNum", "girlNum", "isDelete")










